<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
%>
<script language="javascript" type="text/javascript">
	function seeNews(id){
		$.ajax({
			type : "POST",
			dataType : "html",
			url : "<%=basePath%>/news/seeNews",
			data : {
				id : id
			},
			success : function(data) {
				$("#news-show-div").html(data);
			}
		});
	}
	function editInfo(id){
		$.ajax({
			type : "POST",
			dataType : "html",
			url : "<%=basePath%>/info/gotoInfo",
			data : {
				id: id
			},
			success : function(data) {
				$("#info-edit-div").html(data);
			}
		});
	}
	function deleteInfo(id){
		$.ajax({
			type : "POST",
			dataType : "html",
			url : "<%=basePath%>/info/deleteInfo",
			data : {
				id: id
			},
			success : function() {
				alert('删除成功');
				location.reload();
			}
		});
	}
	$(document).ready(function(){
		/* checkbox all choice */
		$("#allCheck").click(function(){
			if(this.checked){ 
				$("input[name='ids']").each(function(){this.checked=true;}); 
			}else{ 
				$("input[name='ids']").each(function(){this.checked=false;}); 
			} 
		});	
	});
</script>
<table class="pn-ltable" width="100%" cellspacing="1" cellpadding="0"
	border="0" align="center">
	<thead class="pn-lthead">
		<tr>
			<th width="20px">
				<input type="checkbox" id="allCheck" value="checkbox" />
			</th>
			<th>
				ID
			</th>
			<th>
				所属分类
			</th>
			<th>
				字号
			</th>
			<th>
				人均消费
			</th>
			<th>
				发布时间
			</th>
			<th>
				审核状态
			</th>
			<th>
				点击次数
			</th>
			<th>
				操作
			</th>
		</tr>
	</thead>
	<tbody class="pn-ltbody">
		<s:iterator value="infoItemList" id="iil">
			<tr id="result">
				<td>
					<input type="checkbox" name="ids" value="${iil.id }" />
				</td>
				<td>
					${iil.id }
				</td>
				<td>
					${iil.infoSubSort.name }
				</td>
				<td>
					${iil.name }
				</td>
				<td>
					￥${iil.per }
				</td>
				<td>
					${iil.created }
				</td>
				<td>
					${iil.check }
				</td>
				<td>
					${iil.clicked }
				</td>
				<td class="pn-lopt">
					<input type="hidden" name="news.id" value="${iil.id }" />
					<a href="javascript:seeInfo(${iil.id });" class="pn-loperator">查看</a>┆
					<a href="javascript:editInfo(${iil.id });" class="pn-loperator">修改</a>┆
					<a href="javascript:deleteInfo(${iil.id });" class="pn-loperator">删除</a>
				</td>
			</tr>
		</s:iterator>
	</tbody>
</table>